//
// Created by 25137 on 2024/2/13.
//

#ifndef BOOST_ASIO_MIODEVICEBASE_H
#define BOOST_ASIO_MIODEVICEBASE_H

#include <string>
#include <memory>
#include <asio.hpp>
#include <list>
#include <string>
using std::string;
using std::shared_ptr;
class MIODeviceBase {
public:
    typedef enum{
        normal = 0,
        noCOM = -49,
        usedCOM = -66
    }COM_STATUS;
    typedef struct {
        std::string name;
        std::string des;
        COM_STATUS status;
    }COM_Info;
    explicit MIODeviceBase(COM_Info info,int buffer_size = 1024) ;
public:
    COM_Info info;
    shared_ptr<char> buffe;
    shared_ptr<char> buffer;
    const int buffer_size;
    int buffer_len;
    std::function<void(MIODeviceBase)> callback;
    shared_ptr< std::thread> thread_;
};


#endif //BOOST_ASIO_MIODEVICEBASE_H
